package com.example.demo.refactor;

import com.example.demo.refactor.price.*;

/**
 * 影片
 */
public class Movie {

    public static final int CHILDRENS = PriceEnum.CHILDRENS.getPriceCode();
    public static final int REGULAR = PriceEnum.REGULAR.getPriceCode();
    public static final int NEW_RELEASE = PriceEnum.NEWRELEASE.getPriceCode();

    private String title;

    private PriceEnum price;

    public Movie(String title, int priceCode) {
        this.title = title;
        this.price = PriceEnum.getInstance(priceCode);
    }

    public int getPriceCode() {
        return price.getPriceCode();
    }

    public String getTitle() {
        return title;
    }

    //获取金额
    public double getCharge(int dayRented) {
        return price.getCharge(dayRented);
    }

    int getFrequentRenterPoints(int dayRented) {
        return price.getFrequentRenterPoints(dayRented);
    }
}
